package com.example.demo.common;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result<T> {
    private Integer code;
    private String msg;
    private T data; //泛型数据类型

    public static  <T> Result<T> success(T data){
        return new Result<>(200, "success", data);
    }
    public static  <T> Result<T> success(){
        return new Result<>(200, "success", null);
    }

    public static  <T> Result<T> error(){
        return new Result<>(500, "error", null);
    }
}
